#include <iostream>
#include <zlib/lib/I_Ptr.h>

using namespace std;

class Test : public RefCountObj{
public:
	Test() { cout << "create test object...." << endl; }
	~Test() { cout << "destory test object...." << endl; }
};

void test_function2(Ptr<Test> t)
{
	cout << "test object ref conunt is " << t._ptr()->refcount() << endl;
}

void test_function()
{
	Ptr<Test> tp(new Test);
	Ptr<Test> tp1(tp);
	Ptr<Test> tp2 = tp;
  Ptr<Test> tp3;
  tp3 = tp2;
  cout << "test object ref count is " << tp._ptr()->refcount() << endl;
	test_function2(tp3);
	test_function2(tp3);
	test_function2(tp3);
	test_function2(tp3);
	test_function2(tp3);
}

int main()
{
  cout << "-------------test ptr-------------" << endl;
  test_function();
}
